<script setup lang="ts">

</script>

<template>
  <div class="wrap">
    <div class="container">
      <header>Header</header>
      <main>Main</main>
      <nav>Nav</nav>
      <aside>Aside</aside>
      <footer>Footer</footer>
    </div>
    <div class="container">
      <header>Header</header>
      <main>Main</main>
      <nav>Nav</nav>
      <aside>Aside</aside>
      <footer>Footer</footer>
    </div>
  </div>
</template>

<style scoped lang="scss">
.wrap {
  width: 100vw;
  min-height: 100vh;
  font-family: "Exo", Arial, sans-serif;
  background-color: #557;
  color: #fff;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr));
  gap: 1rem;
  place-content: center;
  padding: 1rem;

  .container {
    border: 1px dashed #f36;
    box-shadow: 0 0 0 6px rgb(0 0 0 / 13%);
    border-radius: 1px;
    display: grid;
    grid-template-columns: 220px 1fr 220px;
    grid-template-rows: auto 1fr auto;

    & > * {
      display: flex;
      justify-content: center;
      align-items: center;
      outline: 1px dashed #2938e9;
      outline-offset: -1px;
      border-radius: 4px;
      padding: 1rem;
      color: #fff;
      font-size: clamp(1rem, 1.125rem + 1vw, 1.5rem);
      text-shadow: 1px 1px 0 rgba(0 0 0 / 0.25);
    }

    header {
      background-color: #f1c2c6;
      grid-column: 1 / 4;
      grid-row: 1 / 2;
    }
    footer {
      background-color: #dac2f1;
      grid-column: 1 / 4;
      grid-row: 3 / 4;
    }

    nav {
      background-color: #ccf1c2;
      grid-column: 1 / 2;
      grid-row: 2 / 3;
    }

    aside {
      background-color: #c2e9f1;
      grid-column: 3 / 4;
      grid-row: 2 / 3;
    }

    main {
      background-color: #f1ebc2;
      grid-column: 2 / 3;
      grid-row: 2 / 3;
    }

    &:last-child {
      grid-template-columns:
      [header-start nav-start footer-start] 220px
      [nav-end main-start] 1fr
      [main-end aside-start] 220px
      [aside-end header-end footer-end];
        grid-template-rows:
      [header-start] auto
      [header-end nav-start main-start aside-start] 1fr
      [nav-end main-end aside-end footer-start] auto
      [footer-end];

      header {
        grid-column: header-start / header-end;
        grid-row: header-start / header-end;
      }

      nav {
        grid-column: nav-start / nav-end;
        grid-row: nav-start / nav-end;
      }

      main {
        grid-column: main-start / main-end;
        grid-row: main-start / main-end;
      }

      aside {
        grid-column: aside-start / aside-end;
        grid-row: aside-start / aside-end;
      }

      footer {
        grid-column: footer-start / footer-end;
        grid-row: footer-start / footer-end;
      }

    }
  }
}
</style>
